async function registe(getdata) {
    try {
        let registemsg = await axios({
        url: '/register',
        method: 'POST',
        data: getdata
    })
    console.log(registemsg.data)
    } catch (err) {
        console.log(err)
    }
}

document.querySelector('#btn-register').addEventListener('click', function (e) {
    const from = document.querySelector('.register-form')
    const data = serialize(from, { hash: true, empty: true })
    e.preventDefault()
    if (myname.test(data.username) && mypass.test(data.password)) {
        registe(data)
        // alert('注册成功')
        pxmu.success('注册成功,快去登录吧')
        setTimeout(() => {
            location.href = './login.html'
        }, 1500)
    } else {
        alert('注册失败')
    }
})

//密码显隐
document.querySelector('.input-group-append').addEventListener('click',function(e){
    // console.log(e.target)
    if(e.target.tagName === 'I'){
        // console.log(document.querySelector('#input-password').type)
        if(document.querySelector('#input-password').type === 'password'){
            document.querySelector('#input-password').type = 'text'
            e.target.classList.remove('text-blue')
        }else{
            document.querySelector('#input-password').type = 'password'
            e.target.classList.add('text-blue')
        }
    }
})